//
//  ShopCartCouponCell.m
//  LvXi_newVersion
//
//  Created by 王敏 on 16/9/24.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "ShopCartCouponCell.h"

@implementation ShopCartCouponCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        UIButton * selectedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        selectedBtn.size = CGSizeMake(self.cellHeight*0.5, self.cellHeight*0.5);
        [selectedBtn setImage:[UIImage imageNamed:@"selected_2_default"] forState:UIControlStateNormal];
        [selectedBtn setImage:[UIImage imageNamed:@"selected_2"] forState:UIControlStateSelected];
        [selectedBtn addTarget:self action:@selector(selectedBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        self.selectedBtn = selectedBtn;
        [self.contentView addSubview:self.selectedBtn];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.selectedBtn.x = 2*globalMargin;
    self.selectedBtn.centerY = self.cellHeight*0.5;
    self.nameLabel.x+=self.selectedBtn.width;
}

-(void)selectedBtnClick:(UIButton*)btn{
    if(self.handleCallBack){
        self.handleCallBack(btn);
    }
}

@end
